/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// 平板的时候，歌曲列表页面的左侧的图片

import React from 'react';
import {
  View,
  Text,
  Image,
  StyleSheet,
  ImageBackground,
  useWindowDimensions,
} from 'react-native';

const PlaylistHeaderTable: React.FC = () => {
  const imageNumber = '3456万';
  const playlistTitle = '轻快旋律：这里是疲倦灵魂栖息地';
  const playlistDescription =
    '怀旧使我快乐，人们总是以为自己的生活很枯燥/乏味，那是因为他们没有回过头来聆听那些曾陪伴过我们青春的旋律';

  const fourImages = [
    require('../../../../asset/image/love_count.png'),
    require('../../../../asset/image/download_count.png'),
    require('../../../../asset/image/commen_count.png'),
    require('../../../../asset/image/share.png'),
  ];

  let height = useWindowDimensions().height;

  return (
    <ImageBackground
      source={require('../../../../asset/image/header_background_table.png')}
      style={[
        styles.container,
        {height: height * 0.745, width: (height * 0.745 * 384) / 596},
      ]}>
      <Image
        source={require('../../../../asset/image/cover.png')}
        style={styles.playlistImage}
      />
      <Text style={styles.imageNumber}>{imageNumber}</Text>
      <Text style={styles.textTitle}>{playlistTitle}</Text>
      <Text
        style={styles.textDescription}
        numberOfLines={1}
        ellipsizeMode="tail">
        {playlistDescription}
      </Text>
      <Text style={styles.author}>{'Christopher'}</Text>

      <View style={styles.imagesRow}>
        {fourImages.map((image, index) => (
          <Image key={index} source={image} style={styles.fourImage} />
        ))}
      </View>
    </ImageBackground>
  );
};

const styles = StyleSheet.create({
  container: {
    borderRadius: 24,
    alignItems: 'center',
    flexDirection: 'column',
  },
  playlistImage: {
    width: '73%',
    height: '47%',
    marginTop: '9.3%',
  },
  imageNumber: {
    color: 'rgba(255, 255, 255, 0.86)',
    fontSize: 12,
    position: 'absolute',
    left: '15%',
    top: '50%',
  },
  textTitle: {
    fontSize: 30,
    fontWeight: '700',
    color: 'rgba(255, 255, 255, 0.86)',
    marginTop: '6%',
    width: '83%',
    height: '13.4%',
  },
  textDescription: {
    top: 8,
    fontSize: 12,
    color: 'rgba(255, 255, 255, 0.6)',
    width: '83%',
  },
  author: {
    marginTop: 7,
    fontSize: 14,
    color: 'rgba(255, 255, 255, 0.6)',
    lineHeight: 19,
  },
  imagesRow: {
    flexDirection: 'row',
    top: 28,
    bottom: 24,
    width: '87.5%',
    justifyContent: 'space-between',
  },
  fourImage: {
    width: 48,
    height: 48,
  },
});

export default PlaylistHeaderTable;
